package test4;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.FutureTask;

public class Test {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable myCallable = new MyCallable();
        FutureTask<String> ft = new FutureTask<>(myCallable);

        Thread t = new Thread(ft);
        t.start();
        String sum = ft.get();
        System.out.println("1--100的所有数字的累加和:" + sum);
    }
}
